package nickthissen.iracing.datamodels;

import com.google.gson.Gson;

import java.util.ArrayList;

/**
 * Created by nthissen on 30/05/13.
 */
public class StringArrayResult extends ResultBase
{
    public ArrayList<String> Object;

    public static StringArrayResult fromJson(String json)
    {
        Gson g = new Gson();
        DataModel model = g.fromJson(json, DataModel.class);
        return model.d;
    }

    public static StringArrayResult error(String message, Exception ex)
    {
        StringArrayResult result = new StringArrayResult();
        result.Object = null;
        result.Success = false;
        result.Message = message;
        result.DetailMessage = ex.toString();
        result.Exception = ex;
        return result;
    }

    public static StringArrayResult failed()
    {
        StringArrayResult result = new StringArrayResult();
        result.Success = false;
        return result;
    }

    private static class DataModel
    {
        public StringArrayResult d;
    }
}
